package com.lebang.feign;

import com.lebang.feign.fallback.ListenBookFallback;
import com.lebang.model.RequestUserInfo;
import com.lebangweb.response.JsonData;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author ljx
 */
@FeignClient(name = "wangzhuan-earns", contextId = "wangzhuan-earns-listenBook", fallback = ListenBookFallback.class)
public interface ListenBookFeign {

    /**
     * 添加听书记录
     *
     * @param request
     * @param bookId
     * @param bookMessage
     * @return
     */
    @ApiOperation("添加听书记录")
    @PostMapping("/app/book/add/history")
    JsonData addHistory(@RequestBody RequestUserInfo request,
                               @ApiParam(name = "听书id") @RequestParam(value = "bookId") String bookId,
                               @ApiParam(name = "听书记录") @RequestParam(value = "bookMessage") String bookMessage);

    /**
     * 获取听书历史记录
     *
     * @param request
     * @return
     */
    @ApiOperation("获取听书历史记录")
    @PostMapping("/app/book/get/history")
    JsonData getHistory(@RequestBody RequestUserInfo request,
                               @RequestParam(value = "page") Integer page,
                               @RequestParam(value = "limit") Integer limit);

    /**
     * 获取最新听书记录
     */
    @ApiOperation("获取最新听书记录")
    @PostMapping("/app/book/get/newhistory")
    JsonData getNewHistory(@RequestBody RequestUserInfo request);

    /**
     * 删除听书历史记录
     *
     * @param request
     * @param bookId
     * @return
     */
    @ApiOperation("删除听书历史记录")
    @PostMapping("/app/book/del/history")
    JsonData delHistory(@RequestBody RequestUserInfo request, @ApiParam(name = "听书id") @RequestParam(value = "bookId") String bookId);

    /**
     * 删除所有听书历史记录
     *
     * @param request
     * @return
     */
    @ApiOperation("删除所有听书历史记录")
    @PostMapping("/app/book/delAll/history")
    JsonData delAllHistory(@RequestBody RequestUserInfo request);

    /**
     * 添加听书搜索记录
     *
     * @param request
     * @param content
     * @return
     */
    @ApiOperation("添加听书搜索记录")
    @PostMapping("/app/book/add/searchrecord")
    JsonData addSearchRecord(@RequestBody RequestUserInfo request, @ApiParam(name = "搜索记录") @RequestParam("content") String content);

    /**
     * 获取听书搜索记录
     *
     * @param request
     * @return
     */
    @ApiOperation("获取听书搜索记录")
    @PostMapping("/app/book/get/searchrecord")
    JsonData getSearchRecord(@RequestBody RequestUserInfo request);

    /**
     * 删除听书搜索记录
     *
     * @param request
     * @return
     */
    @ApiOperation("删除听书搜索记录")
    @PostMapping("/app/book/del/searchrecord")
    JsonData delSearchRecord(@RequestBody RequestUserInfo request);

    /**
     * 获取用户听书分类
     *
     * @param request
     * @return
     */
    @ApiOperation("获取用户听书分类")
    @PostMapping("/app/book/get/category")
    JsonData getCategory(@RequestBody RequestUserInfo request);

    /**
     * 更新用户听书分类
     *
     * @param request
     * @param category
     * @return
     */
    @ApiOperation("更新用户听书分类")
    @PostMapping("/app/book/update/category")
    JsonData updateCategory(@RequestBody RequestUserInfo request, @ApiParam(name = "听书分类") @RequestParam("category") String category);


    /**
     * 获取用户解锁章节
     *
     * @param request
     * @param bookId
     * @return
     */
    @ApiOperation("获取用户解锁章节")
    @PostMapping("/app/book/get/unlockchapters")
    JsonData getUnlockChapters(@RequestBody RequestUserInfo request, @ApiParam(name = "听书id") @RequestParam("bookId") String bookId);

    /**
     * 用户解锁章节
     *
     * @param request
     * @param bookId
     * @param chapters
     * @return
     */
    @ApiOperation("用户解锁章节")
    @PostMapping("/app/book/unlock/chapters")
    JsonData unlockChapters(@RequestBody RequestUserInfo request,
                                   @ApiParam(name = "听书id") @RequestParam("bookId") String bookId,
                                   @ApiParam(name = "解锁章节") @RequestParam("chapters") String chapters);
}
